import request from '@/utils/request'

/**
 * 新建回款
 * @param {*} data
 */
export function crmRefundSaveAPI(data) {
  const url = data.entity && data.entity.refundId ? 'update' : 'add'
  return request({
    url: 'crmRefund/' + url,
    method: 'post',
    data: data,
    headers: {
      'Content-Type': 'application/json;charset=UTF-8'
    }
  })
}

// 审核后编辑提交
export function crmRefundCheckOkEdit(data) {
  return request({
    url: '/crmRefund/checkOkEdit',
    method: 'post',
    data: data,
    headers: {
      'Content-Type': 'application/json;charset=UTF-8'
    }
  })
}

/**
 * 回款列表
 * @param {*} data
 */
export function crmRefundIndexAPI(data) {
  return request({
    url: 'crmRefund/queryPageList',
    method: 'post',
    data: data,
    headers: {
      'Content-Type': 'application/json;charset=UTF-8'
    }
  })
}

/**
 * 删除
 * @param {*} data
 *
 */
export function crmRefundDeleteAPI(data) {
  return request({
    url: 'crmRefund/deleteByIds',
    method: 'post',
    data: data,
    headers: {
      'Content-Type': 'application/json;charset=UTF-8'
    }
  })
}

/**
 * 回款详情
 * @param {*} data
 */
export function crmRefundReadAPI(data) {
  return request({
    url: `crmRefund/queryById/${data.id}`,
    method: 'post'
  })
}

/**
 * 回款列表
 * @param {*} data
 *
 */
export function crmRefundFileListAPI(data) {
  return request({
    url: 'crmRefund/queryFileList',
    method: 'post',
    data: data
  })
}

/**
 * tab数量
 * @param {*} data
 *
 */
export function crmRefundNumAPI(data) {
  return request({
    url: 'crmRefund/num',
    method: 'post',
    data: data
  })
}

/**
 * 导出
 * @param {*} data
 */
export function crmRefundExcelExportAPI(data) {
  return request({
    url: 'crmRefund/batchExportExcel',
    method: 'post',
    data: data,
    headers: {
      'Content-Type': 'application/json;charset=UTF-8'
    },
    responseType: 'blob',
    timeout: 60000
  })
}

export function crmRefundExcelAllExportAPI(data) {
  return request({
    url: 'crmRefund/allExportExcel',
    method: 'post',
    data: data,
    responseType: 'blob',
    headers: {
      'Content-Type': 'application/json;charset=UTF-8'
    }
  })
}

/**
 * 转移
 * @param {*} data
 */
export function crmRefundTransferAPI(data) {
  return request({
    url: 'crmRefund/changeOwnerUser',
    method: 'post',
    data: data,
    headers: {
      'Content-Type': 'application/json;charset=UTF-8'
    }
  })
}

/**
 * 转移
 * @param {*} data
 */
export function crmRefundOverdueAPI(data) {
  return request({
    url: 'crmRefund/changeOverdue',
    method: 'post',
    data: data,
    headers: {
      'Content-Type': 'application/json;charset=UTF-8'
    }
  })
}

/**
 * 转移
 * @param {*} data
 */
export function crmQueryOverdueAPI(data) {
  return request({
    url: 'crmRefund/queryOverdueStatus',
    method: 'post',
    headers: {
      'Content-Type': 'application/json;charset=UTF-8'
    }
  })
}
/**
 * 转移退款负责人
 * @param {*} data
 */
export function changeRefundUser(data) {
  return request({
    url: 'crmRefund/changeRefundUser',
    method: 'post',
    data,
    headers: {
      'Content-Type': 'application/json;charset=UTF-8'
    }
  })
}

/**
 * 转移讲师负责人
 */
export function crmRefundTransferTeacherAPI(data) {
  return request({
    url: 'crmRefund/changeTeacherUser',
    method: 'post',
    data: data,
    headers: {
      'Content-Type': 'application/json;charset=UTF-8'
    }
  })
}